﻿Imports System.Windows.Forms
Public Class NotifyIconManager

    Private _icon As NotifyIcon

    Public Event ExitMenuItemClicked(ByVal sender As Object, ByVal e As EventArgs)

    Public Sub New()
        _icon = New NotifyIcon With { _
            .Text = My.Resources.ApplicationName, _
            .Icon = My.Resources.TrayIconNormal}

    End Sub

    Private Sub ExitMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
        RaiseEvent ExitMenuItemClicked(Me, New EventArgs)
    End Sub

    Public Sub ShowIcon()

        _icon.Visible = True
        Dim menu = New Forms.ContextMenu

        menu.MenuItems.Add("終了", AddressOf ExitMenuItem_Click)

        'NotifyIcon.Visible = True
        'NotifyIcon.ContextMenu = menu

    End Sub


End Class
